//
//  SINAUiviewClickLiserner.m
//  sinashebao
//
//  Created by  androidlongs on 2018/1/2.
//  Copyright © 2018年  androidlongs. All rights reserved.
//  UIView 设置点击事件

#import "SINAUiviewClickLiserner.h"

@implementation SINAUiviewClickLiserner

-(void)viewClickFunction:(UIView *)view andWithBlick:( WISViewClickBlock )block{
    
    self.clickBlock = block;
    self.view = view;
    UITapGestureRecognizer *typeTapGestureRecognizer = [[UITapGestureRecognizer alloc]initWithActionBlock:^(id  _Nonnull sender) {
        if (self.clickBlock) {
            self.clickBlock(self.view);
        }
    }];
    // 2. 将点击事件添加到label上
    [self.view addGestureRecognizer:typeTapGestureRecognizer];
    // 可以理解为设置label可被点击
    self.view.userInteractionEnabled = YES;
}

@end
